import java.util.Random;
public class test{
    public static void main(String[] args){
       Random r = new Random();
        int[] arr = new int [20];
        for(int i = 0;i < 20; ){
            int ran = r.nextInt(100) + 1;   //生成[0,100) + 1 = [1,101)的随机数
            boolean set = true;
            for(int j = 0;j < i;j++){
                if(ran == arr[j]){
                    set = false;
                }
            }
            if(set){
                arr[i] = ran;
                i++;
            }  
        } 
        for(int i = 0;i < 20;i++){
            System.out.print(arr[i]+ " ");
        }
    }
}
        
        